<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>库存管理系统</title>
   <link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}">
</head>

<body>
    <h1>录入数据</h1>
    <form id="inventoryForm" method="post">
        <label for="product_id">产品:</label>
        <select id="product_id" name="product_id">
            {% for name, value in product_options.items() %}
            <option value="{{ value }}">{{ name }}</option>
            {% endfor %}
        </select><br>

        <label for="quantity">数量 (单位吨):</label>
        <input type="number" id="quantity" name="quantity" value="1" min="1" max="10" required><br>

        <label>方式:</label>
        <input type="radio" id="in" name="drcr" value="1" checked>
        <label for="in">入库</label>
        <input type="radio" id="out" name="drcr" value="-1">
        <label for="out">出库</label>
        <input type="radio" id="contract" name="drcr" value="0">
        <label for="contract">约定</label><br>

        <label for="company_id">公司:</label>
        <select id="company_id" name="company_id">
            {% for name, value in company_options.items() %}
            <option value="{{ value }}">{{ name }}</option>
            {% endfor %}
        </select><br>

        <label for="warehouse_id">仓库:</label>
        <select id="warehouse_id" name="warehouse_id">
            {% for name, value in warehouse_options.items() %}
            <option value="{{ value }}">{{ name }}</option>
            {% endfor %}
        </select><br>

        <label for="bill_id">单据:</label>
        <input type="text" id="bill_id" name="bill_id" pattern="(IN|OUT|CONTRACT)\d{14}" required><br>

        <label for="create_time">下单时间:</label>
        <input type="datetime-local" id="create_time" name="create_time"
            value="{{ default_create_time.replace(' ', 'T') }}"><br>

        <label for="description">备注说明:</label>
        <textarea id="description" name="description" rows="5" cols="30"></textarea><br>

        <input type="submit" value="提交">
    </form>

    <div id="resultTable"></div>

    <script src="{{ url_for('static', filename='index.js') }}"></script>
</body>

</html>    
